<template>
  <div class="adminbox">
    <el-container style="height: 100%; border: 1px solid #eee">
      <el-aside width="200px" style="background-color: rgb(238, 241, 246)">
        <el-menu :router="true" :default-active="activeMenuIndex">
          <el-menu-item index="/admin/welcome">
            <i class="el-icon-menu"></i>
            <span slot="title">欢迎页</span>
          </el-menu-item>
          <el-menu-item v-for="item in menu" :index="item.path" :key="item.path">
            <i :class="item.icon"></i>
            <span slot="title">{{ item.name }}</span>
          </el-menu-item>
        </el-menu>
      </el-aside>

      <el-container>
        <el-header style="text-align: right; font-size: 12px">
          <el-dropdown>
            <i class="el-icon-setting" style="margin-right: 15px"></i>
            <el-dropdown-menu slot="dropdown">
              <el-dropdown-item>用户退出</el-dropdown-item>
            </el-dropdown-menu>
          </el-dropdown>
          <span>王小虎</span>
        </el-header>

        <el-main>
          <!-- 子路由所在地 -->
          <router-view />
        </el-main>
      </el-container>
    </el-container>
    <button @click="getmenu">++++</button>
  </div>
</template>

<script>
import { mapGetters } from 'vuex'
export default {
  data() {
    return {
      activeMenuIndex: '/admin/welcome',
    }
  },
  computed: {
    ...mapGetters(['menu']),
  },
  methods: {
    getmenu() {
      console.log(this.menu)
    },
  },
}
</script>

<style lang="scss" scoped>
.adminbox {
  height: 100%;
}
.el-header {
  background-color: #b3c0d1;
  color: #333;
  line-height: 60px;
}

.el-aside {
  color: #333;
}
</style>